// 方法的被调用端
function show(a) {
  let fruits = ["banana", "apple", "orange"];

  for (let i = 0; i < fruits.length; i++) {
    let c = fruits[i] + "D";
    console.log(c);
  }
  console.log(a);
  return a ** 2;
}

// 方法的调用端
// let ss = show(3);
// console.log(ss);
// let sss = show(4);
// console.log(sss);

function multipleN(n = 9, key = "$$") {
  // console.log(n)
  //   n = n || 9;
  for (let m = 1; m <= n; m++) {
    let line = "";
    // let a = m;
    for (let i = 1; i <= m; i++) {
      // let b=i;
      let unit = m + "*" + i + "=" + m * i + " ";
      // console.log(unit);
      line = line + unit;
    }
    console.log(line);
  }
  console.log("=======" + key);
}
multipleN(5, "**");
multipleN(11);
multipleN(6);
multipleN();

// function第一种形态
function fn1() {
  let a = 3;
}
function fn2() {
  let b = 4;
}
// function第二种形态
let fn3 = function (aa) {
  console.log("xxxx" + aa);
};
fn3(111);
// function得三种形态 lambda表达式 箭头函数
let fn4 = (aa) => {
  console.log("xxxx" + aa);
};
fn4(222);
//  函数 与 函数体

function fnEx(c) {
  let b = 4;
  console.log(c, b);
  return c*b;
}
let fnEXX = function(c){
    let b = 4;
    console.log(c, b);
    return c*b;
}
fnEXX(3)
let ppp = fnEXX;
ppp(3)

let xxx = 111;
xxx=fnEx(3);
console.log(xxx);

let yyy;
yyy=fnEx;
console.log(yyy(3))


let fnYY = function(c){
    let b = 4;
    console.log(c, b);
    return c*b;
}
// let bbb = fnYY(3);
let aaa = fnYY;
// 游离方法
aaa(3)

// 对象方法
let person = {
    name: "zhangsan",
    age: 18,
    sex: "male",
    show:function(){
        console.log(this.name,this.age,this.sex)
    }
}
person.show();

// 类方法 Math.random()
